package com.dy.nygl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dy.nygl.mapper.MailBoxChatMapper;
import com.dy.nygl.pojo.MailBoxChat;
import com.dy.nygl.service.MailBoxChatService;

@Service("mailBoxChatService")
public class MailBoxChatServiceImpl implements MailBoxChatService{
	
	@Resource(name="mailBoxChatDao")
	private MailBoxChatMapper mailBoxChatDao;
	
	public List<MailBoxChat> selectMailbox(String receiveId, String status){
		if(status == null){
			return mailBoxChatDao.selectNotView(receiveId,status);
		}
		return mailBoxChatDao.selectAll(receiveId);
	}
	
	public void updateMailBox(MailBoxChat mailbox){
		mailbox.setStatus("yes");
		mailBoxChatDao.updateByPrimaryKeySelective(mailbox);
	}
	
	public int addMailBox(MailBoxChat mailbox){
		int i = mailBoxChatDao.insert(mailbox);
		return i;
	}
	
	public int deleteMailBox(Integer id){
		int i = mailBoxChatDao.deleteByPrimaryKey(id);
		return i;
	}
}
